<template>
  <div>
    <el-aside width="isCollapse?70px:150px">
    <div class="toggle-button" @click="toggleCollapse">
        <img src="../assets/light.png" alt="">
        <span class="title" v-show="!isCollapse">light of south lake</span>
    </div>
    <el-menu :default-active="$route.path" class="el-menu-vertical-demo" 
            @close="handleClose" background-color="#545c64" text-color="#6cf5e8" active-text-color="#ffd04b"
            unique-opened :collapse="isCollapse"
            :collapse-transition="false"
            router>
            <!-- router开启路由模式 -->
        
        <el-submenu index="1">
          <template slot="title">
            <i class="el-icon-user"></i>
            <span>用户管理</span>
          </template>
          <el-menu-item index="/admin_users/create">
            <template slot="title">
                <i class="el-icon-location"></i>
                <span>新建用户</span>
            </template>
          </el-menu-item>
          <el-menu-item index="/admin_users/list">
            <template slot="title">
                <i class="el-icon-location"></i>
                <span>用户列表</span>
            </template>
          </el-menu-item>
        </el-submenu>
        <el-submenu index="2">
          <template slot="title">
            <i class="el-icon-s-management"></i>
            <span>权限管理</span>
          </template>
          <el-menu-item index="/roles">
            <template slot="title">
                <i class="el-icon-location"></i>
                <span>角色列表</span>
            </template>
          </el-menu-item>
          <el-menu-item index="/rights"> 
            <template slot="title">
                <i class="el-icon-location"></i>
                <span>权限列表</span>
            </template>
          </el-menu-item>
        </el-submenu>
        <el-submenu index="3">
          <template slot="title">
            <i class="el-icon-suitcase-1"></i>
            <span>商品管理</span>
          </template>
          <el-menu-item index="/products">
            <template slot="title">
                <i class="el-icon-location"></i>
                <span>商品列表</span>
            </template>
          </el-menu-item>
          <el-menu-item index="/params">
            <template slot="title">
                <i class="el-icon-collection-tag"></i>
                <span>分类参数</span>
            </template>
          </el-menu-item>
          <el-menu-item index="/categories">
            <template slot="title">
                <i class="el-icon-location"></i>
                <span>商品分类</span>
            </template>
          </el-menu-item>
        </el-submenu>
        <el-submenu index="4">
          <template slot="title">
            <i class="el-icon-s-order"></i>
            <span>订单管理</span>
          </template>
          <el-menu-item>
            <template slot="title">
                <i class="el-icon-location"></i>
                <span>导航二</span>
            </template>
          </el-menu-item>
        </el-submenu>
        <el-submenu index="5">
          <template slot="title">
            <i class="el-icon-s-marketing"></i>
            <span>数据统计</span>
          </template>
          <el-menu-item>
            <template slot="title">
                <i class="el-icon-location"></i>
                <span>导航二</span>
            </template>
          </el-menu-item>
        </el-submenu>
    </el-menu>
  </el-aside>
  </div>
</template>
<script>
export default({
  data(){
    return{
      isCollapse:false
    }
  },
  methods:{
    toggleCollapse(){
            this.isCollapse = !this.isCollapse
        }
}
})
</script>

<style scoped>
  .toggle-button{
      align-items: center;
      text-align: center;
      line-height: 100%;
  }
  img{
      width: 70px;
      height: 70px;
      border-radius: 32px;
  }
  .el-aside{
      background-color: #ad5b5b;
  }
</style>